package com.xsm.adapter;
import java.util.ArrayList;
import com.xsm.activitygroup.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class gradviewAdapter extends BaseAdapter{
	Holder holder;
	Context context;
	ArrayList<String> values;

	public gradviewAdapter(Context context,ArrayList<String> values){
		this.context=context;
		this.values=values;
	}
	public int getCount() {
		return values.size();
	}

	public Object getItem(int arg0) {
		return values.get(arg0);
	}
	public long getItemId(int arg0) {
		return arg0;
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) {
		holder=new Holder();
		if(arg1==null){
			arg1=LayoutInflater.from(context).inflate(R.layout.gridviewitem, null);
			holder.gicon=(TextView)arg1.findViewById(R.id.gicon);
			arg1.setTag(holder);
		}
		holder=(Holder)arg1.getTag();
		holder.gicon.setText(values.get(arg0));
		return arg1;
	}

	class Holder extends ViewHolder{
		TextView gicon;
	}
}
